from Agent import create_players, morning_discussion_phase, voting_phase, process_voting_results, night_action_phase, game_over

def main():
    
    # 创建玩家
    players, players_werewolf = create_players()

    print("\n=== 游戏开始 ===")
    # 对话轮次
    for round_num in range(10):
        game_flag = game_over(players)  # 判断胜利条件
        if not game_flag:
            break
        # 夜晚阶段
        kill_final_target = night_action_phase(players, players_werewolf, round_num)
        # 早上讨论阶段
        morning_discussion_phase(players, kill_final_target, round_num)
        
        # 投票阶段
        vote_results_list = voting_phase(players, round_num)
        
        # 处理投票结果
        game_flag = process_voting_results(players, players_werewolf, vote_results_list, round_num)
        if not game_flag:
            break
    print("\n=== 对话结束 ===")


if __name__ == "__main__":
    main()
